package com.swgk.core.dialog;

import android.widget.ImageView;

import androidx.annotation.Nullable;

import com.bumptech.glide.Glide;
import com.bumptech.glide.request.RequestOptions;
import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;
import com.swgk.core.R;


import java.util.List;

/**
 * @author: 杨畔
 * @date: 3/9/21 10:25 AM
 * @Description: 凭证图片适配器
 */
public class ImagesAdapter extends BaseQuickAdapter<String, BaseViewHolder> {
    private final RequestOptions options;

    public ImagesAdapter(@Nullable List<String> data) {
        super(R.layout.item_images_pic, data);
        options = new RequestOptions()
                .placeholder(R.mipmap.morentu_change)//图片加载出来前，显示的图片
                .error(R.mipmap.morentu_change);//图片加载失败后，显示的图片
    }

    @Override
    protected void convert(BaseViewHolder helper, String item) {
        Glide.with(mContext).load(item).apply(options).into((ImageView) helper.getView(R.id.iv_certificate_image));
    }
}
